package com.ruoyi.flowable.mapper;

import com.ruoyi.flowable.domain.FormData;
import com.ruoyi.flowable.domain.FormField;
import com.ruoyi.flowable.domain.vo.FormDataVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 单提交数据Mapper接口
 *
 * @author zxw
 * @date 2023-03-28
 */
public interface FormDataMapper extends BaseMapperPlus<FormDataMapper, FormData, FormDataVo> {

    int tableExist(@Param("tableName") String tableName);

    int createMainTable(@Param("tableName") String tableName, @Param("formFields") List<FormField> formFields);

    int createSubTable(@Param("tableName") String tableName,  @Param("formFields") List<FormField> formFields);

    int insertMapData(@Param("tableName") String tableName,  @Param("formData") Map<String,Object> formData);

    List<FormField> getTableColumn(@Param("tableName") String tableName);

    int addColumn(@Param("tableName") String tableName, @Param("formField") FormField formField);

    int dataExist(@Param("tableName") String tableName, @Param("dataId") Long dataId);

    int updateMapData(@Param("tableName") String tableName, @Param("formData") Map<String, Object> formData);

    int deleteMapData(@Param("tableName") String tableName, @Param("dataId") Long dataId);
}
